// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

import Vue from 'vue';
import iconfont from './lib/iconfont.js';
import grayscale from './lib/grayscale.js';
import './lib/canvas-to-blob.js'
import vueQuillEditor from 'vue-quill-editor' // 引入富文本工具
import {Quill} from 'vue-quill-editor';
// 汉化中文字体
const Font = Quill.import('formats/font');
Font.whitelist = ['微软雅黑', 'Arial', '宋体', '黑体', 'Georgia'];
Quill.register(Font, true);
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import store from './store/index'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';
import router from './router'

/*引入指令*/
import directive from './directive'
import * as codes from './lib/returnCode'


Vue.use(ElementUI);

Vue.use(vueQuillEditor);

Vue.config.productionTip = false;

// 判断用户是否登录
router.beforeEach((to, from, next) => {

  next();

  /*// 对路由进行验证
  if (localStorage.getItem('isLogin') == codes.USER_NOT_LOGIN_CODE) {

    // 用户未登陆
    next({path: '/login'})

  } else if (store.state.isLogin == codes.USER_INFO_NULL_CODE) {

    // 用户未完善信息
    next({path: '/LoginRegister'})

  } else {
    // 已经登陆
    next();// 正常跳转到你设置好的页面
  }*/

  /*if (to.matched.some(m => m.meta.auth)) {



    // 对路由进行验证
    if (store.state.isLogin == codes.USER_NOT_LOGIN_CODE ) {

      // 用户未登陆
      next({path: '/login'})

    }else if(store.state.isLogin == codes.USER_INFO_NULL_CODE){

      // 用户未完善信息
      next({path: '/LoginRegister'})

    }else if(store.state.isLogin == codes.SUCCESS_CODE ){
      // 已经登陆
      next();// 正常跳转到你设置好的页面

    }

  } else {
    // 未登录则跳转到登陆界面，query:{ Rurl: to.fullPath}表示把当前路由信息传递过去方便登录后跳转回来；
    next()
  }*/

});
new Vue({
  el: '#app',
  // mode: 'history',
  router,
  store,
  render: h => h(App)
});
